
import Mock from 'mockjs'
export default {
    getMenu: (config) => {
        // console.log("Mock getMenu", param)
        const { username, password } = JSON.parse(config.body)
        if (username === 'admin' && password === 'admin') {
            return {
                code: 20000,
                data: {
                    menu: [
                        {
                            path: "/",
                            name: "home",
                            label: "首页",
                            icon: "s-home",
                            url: "home/index",
                        },
                        {
                            path: "/mall",
                            name: "mall",
                            label: "商品管理",
                            icon: "video-play",
                            url: "mall/index",
                        },
                        {
                            path: "/user",
                            name: "user",
                            label: "用户管理",
                            icon: "user",
                            url: "user/index",
                        },
                        {
                            label: "其他",
                            icon: "location",
                            children: [
                                {
                                    path: "/page1",
                                    name: "page1",
                                    label: "页面1",
                                    icon: "setting",
                                    url: "other/pageOne",
                                },
                                {
                                    path: "/page2",
                                    name: "page2",
                                    label: "页面2",
                                    icon: "setting",
                                    url: "other/pageTwo",
                                },
                            ],
                        },
                    ],
                    token: Mock.Random.guid(),
                    message: "获取成功"
                }

            }
        } else if (username === 'bamboo' && password === "bamboo") {
            return {
                code: 20000,
                data: {
                    menu: [
                        {
                            path: "/",
                            name: "home",
                            label: "首页",
                            icon: "s-home",
                            url: "home/index",
                        },
                        {
                            path: "/user",
                            name: "user",
                            label: "用户管理",
                            icon: "user",
                            url: "user/index",
                        },
                    ],
                    token: Mock.Random.guid(),
                    message: "获取成功"
                }
            }
        } else {
            return {
                code: -999,
                data: {
                    menu: [],
                    message: "获取失败",
                    token: Mock.Random.guid()
                }
            }
        }
    },
    getOperateFormLabel: () => {
        // console.log("Mock getOperateFormLabel", param)
        return {
            code: 20000,
            data: {
                operateFormLabel: [
                    {
                        model: "name",
                        label: "姓名",
                        type: "input",
                    },
                    {
                        model: "age",
                        label: "年龄",
                        type: "input",
                    },
                    {
                        model: "sex",
                        label: "性别",
                        type: "select",
                        opts: [
                            {
                                label: "男",
                                value: 1,
                            },
                            {
                                label: "女",
                                value: 0,
                            },
                        ],
                    },
                    {
                        model: "birth",
                        label: "出生日期",
                        type: "date",
                    },
                    {
                        model: "addr",
                        label: "地址",
                        type: "input",
                    },
                ]
            }
        }
    },
}